import axios from "axios";

export function getCurrentAuthority() {
  // axios.post()
  const role = sessionStorage.getItem("cm9sZQ==");
  if (role !== "4eb118447d8e3cf0" && role !== "de72303d2cb6ea86") return [];
  return role === "4eb118447d8e3cf0" ? ["teacher"] : ["student"];
}

export function check(authorith) {
  const current = getCurrentAuthority();
  return current.some(item => authorith.includes(item));
}

export function isLogin() {
  const current = getCurrentAuthority();
  return current && current[0] !== "guest";
}
